﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using WebMatrix.WebData;

namespace LWJ_Tp_final_Administracion.Controllers
{
    public class AccountController : Controller
    {
        [HttpGet]
        public ActionResult Login()
        {
            return View();
        }
        [HttpPost]
        public ActionResult Login(string username, string password)
        {
            if (WebSecurity.Login(username, password, false))
            {
                ViewBag.Log = true;
                return RedirectToAction("index", "Home");
            }
            ViewBag.LogError = true;
            return View("login");
        }

        public ActionResult Logout()
        {
            WebSecurity.Logout();
            return RedirectToAction("index","Home");
        }
    }

}
